<template>
  <div class="card-wrapper">
    <div class="card-img">
      <img v-if="item.attachUrl" :src="item.attachUrl" alt="" />
      <img v-else src="../../assets/card-img.png" />
    </div>
    <div class="card-desc">
      <div class="card-title">{{ item.devicename }}</div>
      <div class="card-status">
        <em :class="{ 'text-green': item.onlinestatus == 1 }"></em
        >{{ item.onlinestatus == 0 ? "离线" : "在线" }}
      </div>
      <div class="card-line">
        <img src="../../assets/icon-loc.png" />{{ item.routeName }}
      </div>
      <div class="card-line">
        <img src="../../assets/icon-line.png" />{{ item.province }}{{ item.city
        }}{{ item.country }}{{ item.detailAddress }}
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "NewCard",
  props: {
    item: {
      type: Object,
    },
  },
  data() {
    return {};
  },
};
</script>
<style lang="less" scoped>
.card-wrapper {
  .card-desc {
    flex: 1;
    display: flex;
    text-align: left;
    flex-direction: column;
    justify-content: space-between;
    .card-warning {
      font-size: 16px;
      color: #ff001a;
      line-height: 21px;
      position: relative;
      padding-left: 30px;
        img {
          width: 100%;
          position: absolute;
          top: 50%;
          left: 0;
          transform: translateY(-50%);
        }
      }

      span {
        margin-left: 10px;
      }
    }
    .card-title {
      font-size: 20px;
      font-weight: bold;
      color: #1b232d;
      margin: 27px 0;
    }
    .card-status {
      font-size: 14px;
      color: #1b232d;
      margin-bottom: 15px;
      em {
        display: inline-block;
        width: 24px;
        height: 13px;
        background: #ffc73a;
        border-radius: 10px;
        margin-right: 10px;
      }
      .text-green {
        background: #7ecf69;
      }
    }
    .card-line {
      padding-left: 30px;
      font-size: 14px;
      color: #1b232d;
      position: relative;
      margin-bottom: 15px;
      img {
        position: absolute;
        top: 50%;
        left: 0;
        transform: translateY(-50%);
      }
    }
  }
  .card-img {
    height: 230px;
    overflow: hidden;
    img {
      width: 100%;
      height: auto;
    }
  }
</style>
